package messenger;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

public abstract class P2PConnection {
    protected Socket con;
    protected BufferedReader entrada;
    protected PrintWriter saida;
    protected String localIp;
    protected String hostIp;
    
    public P2PConnection(Socket con){
        this.con = con;
        try{
            entrada = new BufferedReader(new InputStreamReader(con.getInputStream()));
            saida = new PrintWriter(con.getOutputStream());
            localIp = con.getLocalAddress().toString();
            hostIp = con.getInetAddress().toString();            
        }catch(Exception e){e.printStackTrace();}
        useConnection();
    }
    
    public abstract void useConnection();
}
